

export const getBaseUrl=(context:string|'')=> {
	var location = window.document.location;
	var pagePath = location.pathname;  
	context = context || "";
	if (context != "") {
		var pos = pagePath.indexOf("/" + context);
		context = pos > -1 ? context : "";
    return location.protocol + "//" + location.host + "/" + context;
	}else{
    return location.protocol + "//" + location.host;
  } 
} 
/**
 * 获取html以及内文档内容
 * @param Url 
 * @returns 
 */
 export function getHtmlContent(Url: string): Promise<string> {
  return new Promise((resolve, reject) => {
    fetch(Url).then(res=>{
      resolve(res.text())
    }).catch(err => {
        reject(err)
      }) 
  })
}
